from django.contrib.auth.models import Group
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet

from apps.meiduo_admin.serializers.admins import AdminSerializer, GroupSerializer
from apps.meiduo_admin.utils import PageNum
from apps.users.models import User


class AdminModelViewSet(ModelViewSet):
    """
    管理员管理
    """
    serializer_class = AdminSerializer
    queryset = User.objects.filter(is_staff=True)
    pagination_class = PageNum




class SimpleGroupView(ListAPIView):
    """
    新增时,用户组的展示
    """
    queryset = Group.objects.all()
    serializer_class = GroupSerializer